﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Text;
using System.Windows.Forms;
using SharepointSolutionInstaller.Utils;
using SharepointSolutionInstaller.Utils.Configuration;

namespace SharepointSolutionInstaller.Views
{
    public partial class RepairView : InstallerControl
    {


        public RepairView()
        {
            InitializeComponent();
            messageLabel.Text = InstallConfiguration.FormatString(messageLabel.Text);
            removeRadioButton.CheckedChanged += new EventHandler(removeRadioButton_CheckedChanged);
            this.Title = Resources.CommonUIStrings.controlTitleRepairRemove;
            this.SubTitle = Resources.CommonUIStrings.controlSubTitleSelectOperation;
        }




        protected internal override void Open(InstallOptions options)
        {
            bool enable = repairRadioButton.Checked || removeRadioButton.Checked;
            Form.operation = InstallOperation.Repair;
            Form.btnNext.Enabled = enable;
            Form.contentControls.Add(new InstallProcess());
        }

        protected internal override void Close(InstallOptions options)
        {

        }

        private void removeRadioButton_CheckedChanged(object sender, EventArgs e)
        {
            if (removeRadioButton.Checked)
            {
                Form.operation = InstallOperation.Uninstall;
            }
            else
            {
                Form.operation = InstallOperation.Repair;
            }
            Form.btnNext.Enabled = true;
        }
    }
}
